<extend name="Public/head" />
<block name="body">
<style type="text/css">
		.mybtn .aui-btn{
			width:200px;
		}

</style>
    <div class="aui-content">
        <div class="aui-form">
            <div class="aui-input-row">
                <i class="aui-input-addon  aui-iconfont aui-icon-lock"></i>
                <input type="password" class="aui-input" name="opassword" placeholder="请输入原始密码" />
            </div>

            <div class="aui-input-row">
                <i class="aui-input-addon  aui-iconfont aui-icon-lock"></i>
                <input type="password" class="aui-input" name="password" placeholder="请输入6-16位新密码" />
            </div>

            <div class="aui-input-row">
                <i class="aui-input-addon  aui-iconfont aui-icon-lock"></i>
                <input type="password" class="aui-input" name="repassword" placeholder="请再次输入新密码" />
            </div>
            <div class="aui-btn-row mybtn">
                <div class="aui-btn aui-btn-success" onclick="send()">确认</div>&nbsp;&nbsp;
                <div class="aui-btn aui-btn-warning" onclick="javascript:history.go(-1);">取消</div>
            </div>
        </div>
    </div>
</block>
<block name="script">
		<script type="text/javascript">
			function send(){
				var o = $('input[name="opassword"]').val();
				var n1 = $('input[name="password"]').val();
				var n2 = $('input[name="repassword"]').val();
				var p = /^[\@A-Za-z0-9\!\#\$\%\^\&\*\.\~]{6,22}$/g ;
				if(n1 != n2 )
				{
					msg('两次输入密码不正确');
					return ;
				}
				if(!p.test(n1))
				{
					msg('密码格式不正确');
					return;
				}

				//验证密码是否正确 .
				post(API + 'changePassword',{old : o ,password:n1 , repassword:n2},function(data){
					if(data.status == 1)
					{
						msg(data.info);
						setTimeout(function(){
							window.location.href = data.url ;
						},2000);
					} else {
						msg(data.info);
					}
				})

			}

		</script>
</block>
